package com.framework.core.api.feign.factory;


import com.framework.core.api.feign.RemoteWeixinService;
import com.framework.core.api.response.WxUserOpenIdRes;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author zhoubb
 * @version V1.0
 * @Date 2020/4/12 13:59
 * @since JDK 1.8
 */
@Slf4j
@Component
public class RemoteWeixinFallbackFactory implements FallbackFactory<RemoteWeixinService> {

    @Override
    public RemoteWeixinService create(Throwable throwable) {
       // log.error(throwable.getMessage());
        return new RemoteWeixinService() {

            @Override
            public WxUserOpenIdRes getWeixinOpenidAndKey(String code) {
                return new WxUserOpenIdRes();
            }

            @Override
            public String getPhoneNumberFromWeixin(String encryptedData, String sessionKey, String iv) {
                return null;
            }
        };
    }
}
